//
//  GenerateViewController.swift
//  testRxSwift
//
//  Created by 火星人 on 2017/7/24.
//  Copyright © 2017年 火星人. All rights reserved.
//

import UIKit
import RxSwift


class GenerateViewController: BaseViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        
        
        self.view.addTapWithHandle { (tap) in
            
            let disBag = DisposeBag()
            
            Observable<Int>.generate(initialState: 0, condition: { (ele) -> Bool in
                
                if ele < 10 {
                    return true
                }
                else {
                    return false
                }
            }, iterate: { (ele) -> Int in
                return ele + 1
            }).subscribe({ (eve) in
                print(eve)
            }).disposed(by: disBag)
        }
    }

}
